package twelve;

import static util.Print.print;

/**
 * Created by 佳文 on 2016/11/4.
 */
class MyException extends Exception{
    MyException(){}
    MyException(String msg){super(msg);}
}
public class lesson2 {
    public static void f() throws MyException{
        print("Throwing MyException from f()");
        throw new MyException();
    }
    public static void g() throws MyException{
        print("Throwing MyException from g()");
        throw new MyException("Originated in g()");
    }
    public static void main(String[] args){
        try{f();}catch (MyException e){
            e.printStackTrace(System.out);
        }
        try{g();}catch (MyException e){
            e.printStackTrace(System.out);
        }
    }
}
